@extends("layouts.common")
@section("content")

    <div class="row">
        <div class="col-lg-12">
            <h3 class="page-header"><i class="fa fa-table"></i>我的客户</h3>
            <ol class="breadcrumb">
                <li><i class="fa fa-home"></i><a href="/welcome">Home</a></li>
                <li><i class="fa fa-table"></i><a href="/welcome">我的客户</a></li>
                <li><i class="fa fa-table"></i>交易记录</li>
            </ol>
        </div>
    </div>


    <div class="row">

        <div class="col-lg-12">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h2><i class="fa fa-table red"></i><span class="break"></span><strong>交易记录</strong></h2>
                </div>

                <div class="panel-body">
                    <table class="table table-condensed">
                        <thead>
                        <tr>
                            <th>类型</th>
                            <th>开始日期</th>
                            <th>结束日期</th>
                            <th>交易类型</th>
                            <th>交易佣金</th>
                            <th>隔夜费</th>
                            <th>买入价格</th>
                            <th>卖出价格</th>
                            <th>手数</th>
                            <th>盈亏</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($list as $val)
                        <tr>
                            <td>{{$val->type}}</td>
                            <td>{{$val->starttime}}</td>
                            <td>{{$val->endtime}}</td>
                            <td>{{$val->item}}</td>
                            <td>{{$val->commission}}</td>
                            <td>{{$val->day_money}}</td>
                            <td>{{$val->startprice}}</td>
                            <td>{{$val->endprice}}</td>
                            <td>{{$val->size}}</td>
                            <td>{{$val->profit}}</td>

                        </tr>
                            @endforeach

                        </tbody>
                    </table>
                    @include("layouts.page",['paginator'=>$list])
                </div>

                <div class="modal fade" id="releaseModal" tabindex="-1" role="dialog" aria-labelledby="releaseModalLabel" aria-hidden="true">
                    <div class="modal-dialog">
                        <div class="modal-content">
                            <div class="modal-header">
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                                <h4 class="modal-title" id="releaseModalLabel">提示</h4>
                            </div>
                            <div class="modal-body">
                                你确定要升级为代理？
                            </div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                                <a  class="btn btn-primary active btn-sm" data-val="" role="button">确定</a>
                            </div>
                        </div>
                    </div>
                </div>

            </div>
        </div><!--/col-->
    </div>
    <script src="https://cdn.bootcss.com/jquery/2.2.1/jquery.min.js"></script>
    <style>
        td,th{
            text-align: center;
        }
    </style>

    <script>
        $(function(){
            $(".btn-release").click(function(){
                $("#releaseModal").find('.modal-footer .btn-primary').attr('href', "/customer/upgrade/" + $(this).data("val"));
            });

            var search = location.search.substring(1);
            if (search) {
                try {
                    var query = JSON.parse('{"' + decodeURIComponent(search).replace(/"/g, '\\"').replace(/&/g, '","').replace(/=/g, '":"') + '"}');

                    $.each(query, function(k, v) {
                        $('[name=' + k + ']').val(v);
                    });
                } catch (e) {
                    console.log(e);
                }

            }
        });

    </script>
@endsection